{% set pypi_name = 'python-solumclient' %}
{% set upstream_version = upstream_version('3.2.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Python API and CLI for OpenStack Solum
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('PrettyTable') }}
BuildRequires:  {{ py3('PyYAML') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('httplib2') }}
BuildRequires:  {{ py3('jsonschema') }}
BuildRequires:  {{ py3('python-keystoneclient') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.log') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
Client library for Solum built on the Solum API. It provides a Python API
(the solumclient module) and a command-line tool (solum).

%package -n python3-solumclient
Summary:        Python API and CLI for OpenStack Solum
Requires:       {{ py3('Babel') }}
Requires:       {{ py3('PrettyTable') }}
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('httplib2') }}
Requires:       {{ py3('iso8601') }}
Requires:       {{ py3('jsonschema') }}
Requires:       {{ py3('python-keystoneclient') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}

%description -n python3-solumclient
Client library for Solum built on the Solum API. It provides a Python API
(the solumclient module) and a command-line tool (solum).

This package contains the Python 3.x module.

%package doc
Summary:        Documentation for OpenStack Solum API client libary
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}

%description doc
Client library for Solum built on the Solum API. It provides a Python API
(the solumclient module) and a command-line tool (solum).
This package contains the documentation.

%prep
%autosetup -n %{name}-%{version}
%py_req_cleanup

%build
%py3_build

# Build HTML docs and man page
PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
PBR_VERSION=%{version} %sphinx_build -b man doc/source doc/build/man
rm -r doc/build/html/.{doctrees,buildinfo}

%install
%py3_install

%check
%{__python3} -m stestr.cli run

%files -n python3-solumclient
%doc README.rst
%license LICENSE
%{python3_sitelib}/solumclient
%{python3_sitelib}/*.egg-info
%{_bindir}/solum
%{_bindir}/solum-app-setup.py

%files doc
%doc doc/build/html
%license LICENSE

%changelog
